﻿using System;
using System.Reflection;
using CompactMapper.Orm.Annotations;

namespace CompactMapper.Orm.UnitOfWork.Mappings.Meta.PropertyInfos.Relations
{
    public class OneToMany : Relation
    {
        private readonly OneToManyAttribute _attribute;
        private readonly String _tableName;

        public OneToMany(PropertyInfo propertyInfo)
            : base(propertyInfo)
        {
            _attribute = GetOneToManyAttribute();
            _tableName = GetSomethingToManyTableName();
        }

        public OneToManyAttribute OneToManyAttribute
        {
            get { return _attribute; }
        }

        public override string TableName
        {
            get { return _tableName; }
        }
    }
}